Skip to content

Adding OpenCode agent default mode and CLI workspace mode#412

Merged
DhavalRepo18 merged 2 commits into
mainfrom
opencode_agent
Jun 26, 2026
Merged

Adding OpenCode agent default mode and CLI workspace mode#412
DhavalRepo18 merged 2 commits into
mainfrom
opencode_agent

Conversation

@ChathurangiShyalika

@ChathurangiShyalika ChathurangiShyalika commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Revises opencode_agent runner backed by the OpenCode CLI and integrates it with the AssetOpsBench scenario suite.

This PR supports two execution modes:

  • Default MCP-only mode: OpenCode can use AssetOpsBench MCP tools, while local files, bash, edits, and web access are disabled.
  • Optional CLI workspace mode: benchmark runs can create a dedicated per-run workspace and allow file inspection and bash execution so the agent can run local Python/code-based analysis.

Changes

  • Added OpenCodeAgentRunner and opencode-agent CLI entry point.
  • Added OpenCode config generation for AssetOpsBench MCP servers.
  • Added support for OpenCode model IDs including direct providers and router-backed models.
  • Added scenario-suite integration via --agent_name opencode_agent.
  • Added optional workspace flags:
    • --opencode-workspace-root
    • --opencode-allow-files
    • --opencode-allow-bash
    • --opencode-allow-edit
  • Kept web access disabled by default.
  • Denied OpenCode external_directory access by default.
  • Added tests for runner config, permissions, workspace handling, and scenario-suite command construction.
  • Added docs for OpenCode agent usage and CLI workspace mode.

Safety Notes

By default, the agent is MCP-only and cannot inspect local files, run bash, edit files, or access the web.

CLI capabilities are opt-in. When file or bash access is enabled, each scenario run receives a dedicated workspace directory. This gives CLI agents a place to write scripts, temporary files, and intermediate artifacts.

--opencode-allow-bash is not a hard OS-level sandbox. For strict filesystem isolation, the benchmark should be run inside Docker or another sandboxed environment.

Testing

.venv/bin/pytest src/agent/opencode_agent/tests/test_runner.py
.venv/bin/pytest src/benchmark/tests/test_scenario_suite_runner.py

Signed-off-by: Chathurangi Shyalika <chathurangishyalika@Chathurangis-MacBook-Pro.local>
@ChathurangiShyalika ChathurangiShyalika changed the title Tighten default permissions for benchmark runs. Tighten default permissions for benchmark runs in opencode agent. Jun 25, 2026
@ChathurangiShyalika ChathurangiShyalika changed the title Tighten default permissions for benchmark runs in opencode agent. Adding OpenCode agent default mode and CLI workspace mode Jun 25, 2026
Signed-off-by: Chathurangi Shyalika <chathurangishyalika@Chathurangis-MacBook-Pro.local>
@DhavalRepo18 DhavalRepo18 merged commit f8d71e4 into main Jun 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants